<?php

namespace backend\controllers;

use app\event\OrderPayEvent;
use app\Listeners\OrderPayHandler;
use app\models\EsProduct;
use app\models\Menu;
use app\models\Order;
use app\models\Product;
use backend\components\ResponseJson;
use backend\components\Result;
use backend\models\product\ProductTemplateFlow;
use backend\queue\Job;
use common\models\User;
use Yii;
use yii\base\UserException;
use yii\base\View;
use yii\db\Query;
use yii\db\StaleObjectException;

class IndexController extends \yii\web\Controller
{
    use ResponseJson;

    public function __construct($id, $module, $config = [])
    {
        parent::__construct($id, $module, $config);
    }


    public function __destruct()
    {
        return '最后执行的函数';
    }


    public $layout_data;
    public function actionIndex()
    {
        $this->layout_data = '测试给前端传值************************************************';
        $model = new User();
//        $product_price = ProductTemplateFlow::findOne(['template_id'=>820]);
//        var_dump($product_price);
//        die();
        return $this->render('index', ['model' => $model]);
    }


    /**
     * Notes: 原生sql执行测试
     * User: Administrator
     * DateTime: 2021/4/1 14:27
     */
    public function actionTestSql()
    {
        $db = \Yii::$app->db;
        // 返回多行，每行都是列名和值的关联数组，没有返回空
        $posts = $db->createCommand('select * from country')->queryAll();
        // 返回一行，没有返回flase
        $posts = $db->createCommand('select * from menu where id=3')->queryOne();
        // 返回一列, 没有则返回空数组
        $posts = $db->createCommand('select name from menu')->queryColumn();
        // 返回一个标量值，如果该查询没有则返回false
        $count = $db->createCommand('select count(*) from menu')->queryScalar();

        // 绑定参数 例如http://test-youtube.com/index/test-sql?id=2
        $posts = $db->createCommand('select * from menu where id=:id and status=:status')->bindValue(':id', $_GET['id'])->bindValue(':status', 1)->queryOne();
        // 使用bindparam函数
        $params = [':id' => $_GET['id'], ':status' => 1];
        $posts  = $db->createCommand('select * from menu where id=:id and status=:status')->bindValues($params)->queryOne();
        $posts  = $db->createCommand('select * from menu where id=:id and status=:status', $params)->queryOne();

        // 执行非查询语句 多次插入用batchInsert()
        $posts = $db->createCommand()->insert('menu', ['name' => '用户管理', 'parent' => 1, 'route' => '/admin/user/', 'order' => 20, 'data' => '', 'status' => 1])->execute();
        return $this->jsonOutput($posts);
    }


    /**
     * Notes: query查询数据,查询的时候尽量使用query,activerecord 查出来是对象
     * User: Administrator
     * DateTime: 2021/4/1 17:06
     * @return array
     */
    public function actionQuery()
    {
        $rows = (new Query())->select(['*'])->from('menu')->where(['id' => 1])->all();
        return $this->jsonOutput($rows);
    }


    /**
     * Notes: 活动记录。
     * User: Administrator
     * DateTime: 2021/4/1 17:07
     * @return array
     */
    public function actionActiveRecord()
    {
        $rows = Menu::find()->where(['id' => 1])->one();
        // 获取单条数据
        $rows = Menu::findOne(1);
        // 批量获取数据
        foreach (Menu::find()->batch(10) as $batch) {
            var_dump($batch);
        }

        return $this->jsonOutput($rows);
    }


    /**
     * Notes:  activate 尽量用于查询和修改数据，查出来是个对象不利于处理。
     * User: Administrator
     * DateTime: 2021/4/2 9:52
     */
    public function actionQueryJson()
    {
        $query = Menu::find()->where(['id' => 1]);
        return $this->jsonOutput();
    }


    /**
     * Notes:  测试乐观锁机制
     * User: Administrator
     * DateTime: 2021/4/2 10:26
     * @param $id
     * @return string
     */
    public function actionUpdate($id)
    {
        $model = Menu::findOne($id);
        if (empty($model)) {
            return $this->jsonErr('未找到');
        }
        if ($this->request->isPost) {
            if($model->load($this->request->post()) && $model->validate())
            {
                try
                {
                    $res = $model->save();
                }
                catch(StaleObjectException $e)
                {
                    throw new UserException('有他人已经编辑过了，你的文档过于陈旧，请刷新后重新编辑');
                }
                // 保存成功
                if(false !== $res)
                {
                    return json_encode([
                        'code' => 0,
                        'message' => '保存成功'
                    ]);
                }
            }
            throw new UserException('数据验证失败：' . json_encode($model->errors));
        }
        return $this->render('view', ['model'=>$model]);
    }


    /**
     * Notes: 测试独立action方法， 在service文件定义这个文件。
     * User: Administrator
     * DateTime: 2021/4/2 11:42
     * @return array
     */
    public function actions()
    {
        return ['demo'=>'app\service\DemoAction']; // TODO: Change the autogenerated stub
    }


    /**
     * Notes: 解析json传递过来数据格式
     * User: Administrator
     * DateTime: 2021/4/2 15:18
     * @return Result
     * @throws \Exception
     */
    public function actionBaseObject()
    {
        $json = '{"code": 100000, "message": "获取成功", "data": [{"time": "2020-01-01 11:00:00", "log": "已接单"}]}';
        $reuslt =  Result::newInstance($json);
        return $reuslt;
    }


    /**
     * Notes: 测试事件 全局事件
     * User: Administrator
     * DateTime: 2021/4/2 15:19
     */
    public function actionEvent()
    {
        \Yii::$app->trigger(OrderPayHandler::ORDER_PAY, new OrderPayEvent([
            'order_sn' => '202001010101'
        ]));
    }


    /**
     * Notes: 测试redis使用
     * User: Administrator
     * DateTime: 2021/4/2 17:45
     * @return mixed
     */
    public function actionRedis()
    {
        $redeis = Yii::$app->redis;
//        $list = $redeis->set('test', 'aaaaa');
        $list = $redeis->lget('userID');
        return $list;
    }


    /**
     * Notes: 测试消息队列方法。
     * User: aniu
     * DateTime: 2021/4/3 9:18
     * @return string
     */
    public function actionJob()
    {
        $user = User::findOne(1);
        Yii::$app->queue->push(new Job([
            'userID' => $user->id
        ]));

        // 如果要实现短信 10分钟后发送
        // 通过 ->delay()方法，其中参数是延迟秒数，延迟多少自己计算就可以达到
        Yii::$app->queue->delay(10)->push(new Job([
            'userID' => $user->id
        ]));
        return '成功';
    }


    public function actionEs()
    {
        $product = EsProduct::findOne(6);
        return $this->jsonOutput($product);
    }


    public function actionTest()
    {
        phpinfo();
        $bool = [];
        if (!empty($bool)){
            echo 'aaaa';
        }else{
            echo 'bbbbb.php';
        }
    }


    /**
     * Notes: 测试sql当中的with
     * User: Administrator
     * DateTime: 2021/4/12 16:31
     */
    public function actionWith()
    {
//        $orders = Order::find()->with('address')->limit(10)->all();
        $orders = Order::find()->where(['ext_order_id'=>'H202105051736'])->one();
        if (!empty($orders->ext_order_id)){
            var_dump(rand(0,9));
        }else{
            var_dump('ok');
        }
        die();
//        foreach ($orders as $order) {
//            $order_items = $order->items;
//            var_dump($order_items);
//        }
//        $product = Product::find()->limit(10)->orderBy(['id'=>SORT_DESC])->all();
//        foreach ($product as $item) {
//            var_dump($item);
//        }
        return $this->jsonOutput($orders);
    }


    public function actionArrayJson()
    {
//        $array = array (
//            'guuid' => NULL,
//            'jeulia_ismobile' => false,
//            'apikey' => 'helloice.com',
//            'store_id' => 1,
//            'state' => 'processing',
//            'increment_id' => 'H101984843',
//            'order_id' => '338284',
//            'status' => 'processing',
//            'order_currency_code' => 'USD',
//            'coupon_code' => 'free',
//            'customer_id' => '1000560',
//            'shipping_description' => '3-Day Shipping - 3-Day Shipping',
//            'shipping_method' => 'accelerate_standard',
//            'total_item_count' => '2',
//            'grand_total' => '94.9900',
//            'subtotal' => '124.9800',
//            'shipping_amount' => '25.0000',
//            'shipping_discount_amount' => '0.0000',
//            'discount_amount' => '-54.9900',
//            'discount_points' => NULL,
//            'discount_points_amount' => NULL,
//            'base_grand_total' => '94.9900',
//            'base_subtotal' => '124.9800',
//            'base_shipping_amount' => '25.0000',
//            'base_shipping_discount_amount' => '0.0000',
//            'base_discount_amount' => '-54.9900',
//            'base_discount_points_amount' => NULL,
//            'discount_description' => 'Buy 1 Get 1 Free',
//            'coupon_rule_name' => 'FREE',
//            'order_payment' =>
//                array (
//                    'method' => 'afterpaytouch',
//                ),
//            'payment_at' => 1618428964,
//            'transaction_id' => '1316184287158075',
//            'gift_card_discount_amount' => NULL,
//            'base_gift_card_discount_amount' => NULL,
//            'store_credit_discount_amount' => NULL,
//            'base_store_credit_discount_amount' => NULL,
//            'base_tariff_insurance_amount' => '0.0000',
//            'tariff_insurance_amount' => '0.0000',
//            'prime_discount_amount' => '0.0000',
//            'base_prime_discount_amount' => '0.0000',
//            'gift_items' =>
//                array (
//                    0 =>
//                        array (
//                            'sku' => 'HFC001',
//                            'name' => 'Free 5mm Miami Cuban Chain',
//                            'row_total' => 0,
//                            'base_row_total' => '0',
//                            'qty' => 1,
//                        ),
//                ),
//            'has_gift' => true,
//            'has_prime_gift' => 0,
//            'presale' => 0,
//            'presale_timeline' => '',
//            'order_address' =>
//                array (
//                    0 =>
//                        array (
//                            'entity_id' => '671696',
//                            'parent_id' => '338284',
//                            'customer_address_id' => NULL,
//                            'quote_address_id' => NULL,
//                            'region_id' => '12',
//                            'customer_id' => NULL,
//                            'fax' => NULL,
//                            'region' => 'California',
//                            'postcode' => '93436',
//                            'lastname' => 'perez ',
//                            'street' => '940 w chestnut ave',
//                            'city' => 'lompoc',
//                            'email' => 'anttperezzo@gmail.com',
//                            'telephone' => '8053192642',
//                            'country_id' => 'US',
//                            'firstname' => 'anthony ',
//                            'address_type' => 'shipping',
//                            'prefix' => NULL,
//                            'middlename' => NULL,
//                            'suffix' => NULL,
//                            'company' => NULL,
//                            'vat_id' => NULL,
//                            'vat_is_valid' => NULL,
//                            'vat_request_id' => NULL,
//                            'vat_request_date' => NULL,
//                            'vat_request_success' => NULL,
//                        ),
//                    1 =>
//                        array (
//                            'entity_id' => '671697',
//                            'parent_id' => '338284',
//                            'customer_address_id' => NULL,
//                            'quote_address_id' => NULL,
//                            'region_id' => '12',
//                            'customer_id' => NULL,
//                            'fax' => NULL,
//                            'region' => 'California',
//                            'postcode' => '93436',
//                            'lastname' => 'perez ',
//                            'street' => '940 w chestnut ave',
//                            'city' => 'lompoc',
//                            'email' => 'anttperezzo@gmail.com',
//                            'telephone' => '8053192642',
//                            'country_id' => 'US',
//                            'firstname' => 'anthony ',
//                            'address_type' => 'billing',
//                            'prefix' => NULL,
//                            'middlename' => NULL,
//                            'suffix' => NULL,
//                            'company' => NULL,
//                            'vat_id' => NULL,
//                            'vat_is_valid' => NULL,
//                            'vat_request_id' => NULL,
//                            'vat_request_date' => NULL,
//                            'vat_request_success' => NULL,
//                        ),
//                ),
//            'order_items' =>
//                array (
//                    0 =>
//                        array (
//                            'item_id' => '491863',
//                            'order_id' => '338284',
//                            'parent_item_id' => NULL,
//                            'quote_item_id' => '3153997',
//                            'store_id' => '1',
//                            'created_at' => '2021-04-14 19:31:53',
//                            'updated_at' => '2021-04-14 19:31:53',
//                            'product_id' => '1397',
//                            'product_type' => 'simple',
//                            'product_options' =>
//                                array (
//                                    'info_buyRequest' =>
//                                        array (
//                                            'uenc' => 'aHR0cHM6Ly93d3cuaGVsbG9pY2UuY29tL3Byb2R1Y3RzL2ljZWQtY29tcGFzcy1wZW5kYW50',
//                                            'product' => '1397',
//                                            'selected_configurable_option' => '',
//                                            'related_product' => '',
//                                            'qty' => '1',
//                                            'additional_data' => '{"options":{"necklaceSize":{"type":"select","value":"Silver","label":"Silver"},"customEngravings":[{"value":"𝐴𝑑𝑟𝑖𝑎𝑛𝑎 ","index":0,"font":null,"label":"Engraving on Backside+ $5.00","basePrice":"5","price":5}]}}',
//                                            'back_button' => '1',
//                                        ),
//                                ),
//                            'weight' => NULL,
//                            'is_virtual' => '0',
//                            'sku' => 'HP485',
//                            'name' => 'Iced Compass Pendant',
//                            'description' => NULL,
//                            'applied_rule_ids' => '464',
//                            'additional_data' => '{"options":{"necklaceSize":{"type":"select","value":"Silver","label":"Silver"},"customEngravings":[{"value":"\\ud835\\udc34\\ud835\\udc51\\ud835\\udc5f\\ud835\\udc56\\ud835\\udc4e\\ud835\\udc5b\\ud835\\udc4e ","index":0,"font":null,"label":"Engraving on Backside+ $5.00","basePrice":"5","price":5}]},"base_unit_price":54.99,"unit_price":54.99,"option_subtotal":5,"finalPrice":54.99,"basePrice":54.99,"currency_code":"USD"}',
//                            'is_qty_decimal' => '0',
//                            'no_discount' => '0',
//                            'qty_backordered' => NULL,
//                            'qty_canceled' => '0.0000',
//                            'qty_invoiced' => '0.0000',
//                            'qty_ordered' => '1.0000',
//                            'qty_refunded' => '0.0000',
//                            'qty_shipped' => '0.0000',
//                            'base_cost' => NULL,
//                            'price' => '54.9900',
//                            'base_price' => '54.9900',
//                            'original_price' => '49.9900',
//                            'base_original_price' => '49.9900',
//                            'tax_percent' => '0.0000',
//                            'tax_amount' => '0.0000',
//                            'base_tax_amount' => '0.0000',
//                            'tax_invoiced' => '0.0000',
//                            'base_tax_invoiced' => '0.0000',
//                            'discount_percent' => '0.0000',
//                            'discount_amount' => '54.9900',
//                            'base_discount_amount' => '54.9900',
//                            'discount_invoiced' => '0.0000',
//                            'base_discount_invoiced' => '0.0000',
//                            'amount_refunded' => '0.0000',
//                            'base_amount_refunded' => '0.0000',
//                            'row_total' => '54.9900',
//                            'base_row_total' => '54.9900',
//                            'row_invoiced' => '0.0000',
//                            'base_row_invoiced' => '0.0000',
//                            'row_weight' => '0.0000',
//                            'base_tax_before_discount' => NULL,
//                            'tax_before_discount' => NULL,
//                            'ext_order_item_id' => NULL,
//                            'locked_do_invoice' => NULL,
//                            'locked_do_ship' => NULL,
//                            'price_incl_tax' => '54.9900',
//                            'base_price_incl_tax' => '54.9900',
//                            'row_total_incl_tax' => '54.9900',
//                            'base_row_total_incl_tax' => '54.9900',
//                            'discount_tax_compensation_amount' => '0.0000',
//                            'base_discount_tax_compensation_amount' => '0.0000',
//                            'discount_tax_compensation_invoiced' => NULL,
//                            'base_discount_tax_compensation_invoiced' => NULL,
//                            'discount_tax_compensation_refunded' => NULL,
//                            'base_discount_tax_compensation_refunded' => NULL,
//                            'tax_canceled' => NULL,
//                            'discount_tax_compensation_canceled' => NULL,
//                            'tax_refunded' => NULL,
//                            'base_tax_refunded' => NULL,
//                            'discount_refunded' => NULL,
//                            'base_discount_refunded' => NULL,
//                            'free_shipping' => '0',
//                            'gift_message_id' => NULL,
//                            'gift_message_available' => '0',
//                            'weee_tax_applied' => NULL,
//                            'weee_tax_applied_amount' => NULL,
//                            'weee_tax_applied_row_amount' => NULL,
//                            'weee_tax_disposition' => NULL,
//                            'weee_tax_row_disposition' => NULL,
//                            'base_weee_tax_applied_amount' => NULL,
//                            'base_weee_tax_applied_row_amnt' => NULL,
//                            'base_weee_tax_disposition' => NULL,
//                            'base_weee_tax_row_disposition' => NULL,
//                            'base_aw_reward_points_amount' => '0.0000',
//                            'aw_reward_points_amount' => '0.0000',
//                            'aw_reward_points' => '0',
//                            'base_aw_reward_points_refunded' => NULL,
//                            'aw_reward_points_refunded' => NULL,
//                            'aw_reward_points_blnce_refunded' => NULL,
//                            'base_aw_reward_points_reimbursed' => NULL,
//                            'aw_reward_points_reimbursed' => NULL,
//                            'aw_reward_points_blnce_reimbursed' => NULL,
//                            'base_aw_reward_points_invoiced' => NULL,
//                            'aw_reward_points_invoiced' => NULL,
//                            'aw_reward_points_blnce_invoiced' => NULL,
//                            'osc_gift_wrap_amount' => NULL,
//                            'base_osc_gift_wrap_amount' => NULL,
//                        ),
//                    1 =>
//                        array (
//                            'item_id' => '491864',
//                            'order_id' => '338284',
//                            'parent_item_id' => NULL,
//                            'quote_item_id' => '3154021',
//                            'store_id' => '1',
//                            'created_at' => '2021-04-14 19:31:53',
//                            'updated_at' => '2021-04-14 19:31:53',
//                            'product_id' => '723',
//                            'product_type' => 'simple',
//                            'product_options' =>
//                                array (
//                                    'info_buyRequest' =>
//                                        array (
//                                            'uenc' => 'aHR0cHM6Ly93d3cuaGVsbG9pY2UuY29tL3Byb2R1Y3RzL2ljZWQtYmFndWV0dGUtZGlhbW9uZC1jcm9zcy1wZW5kYW50',
//                                            'product' => '723',
//                                            'selected_configurable_option' => '',
//                                            'related_product' => '',
//                                            'qty' => '1',
//                                            'additional_data' => '',
//                                            'back_button' => '1',
//                                        ),
//                                ),
//                            'weight' => NULL,
//                            'is_virtual' => '0',
//                            'sku' => 'HP383',
//                            'name' => 'Iced Baguette Diamond Cross Pendant',
//                            'description' => NULL,
//                            'applied_rule_ids' => '464',
//                            'additional_data' => '{"base_unit_price":129.99,"unit_price":129.99,"option_subtotal":0,"finalPrice":69.99,"basePrice":69.99,"currency_code":"USD"}',
//                            'is_qty_decimal' => '0',
//                            'no_discount' => '0',
//                            'qty_backordered' => NULL,
//                            'qty_canceled' => '0.0000',
//                            'qty_invoiced' => '0.0000',
//                            'qty_ordered' => '1.0000',
//                            'qty_refunded' => '0.0000',
//                            'qty_shipped' => '0.0000',
//                            'base_cost' => NULL,
//                            'price' => '69.9900',
//                            'base_price' => '69.9900',
//                            'original_price' => '129.9900',
//                            'base_original_price' => '129.9900',
//                            'tax_percent' => '0.0000',
//                            'tax_amount' => '0.0000',
//                            'base_tax_amount' => '0.0000',
//                            'tax_invoiced' => '0.0000',
//                            'base_tax_invoiced' => '0.0000',
//                            'discount_percent' => '0.0000',
//                            'discount_amount' => '0.0000',
//                            'base_discount_amount' => '0.0000',
//                            'discount_invoiced' => '0.0000',
//                            'base_discount_invoiced' => '0.0000',
//                            'amount_refunded' => '0.0000',
//                            'base_amount_refunded' => '0.0000',
//                            'row_total' => '69.9900',
//                            'base_row_total' => '69.9900',
//                            'row_invoiced' => '0.0000',
//                            'base_row_invoiced' => '0.0000',
//                            'row_weight' => '0.0000',
//                            'base_tax_before_discount' => NULL,
//                            'tax_before_discount' => NULL,
//                            'ext_order_item_id' => NULL,
//                            'locked_do_invoice' => NULL,
//                            'locked_do_ship' => NULL,
//                            'price_incl_tax' => '69.9900',
//                            'base_price_incl_tax' => '69.9900',
//                            'row_total_incl_tax' => '69.9900',
//                            'base_row_total_incl_tax' => '69.9900',
//                            'discount_tax_compensation_amount' => '0.0000',
//                            'base_discount_tax_compensation_amount' => '0.0000',
//                            'discount_tax_compensation_invoiced' => NULL,
//                            'base_discount_tax_compensation_invoiced' => NULL,
//                            'discount_tax_compensation_refunded' => NULL,
//                            'base_discount_tax_compensation_refunded' => NULL,
//                            'tax_canceled' => NULL,
//                            'discount_tax_compensation_canceled' => NULL,
//                            'tax_refunded' => NULL,
//                            'base_tax_refunded' => NULL,
//                            'discount_refunded' => NULL,
//                            'base_discount_refunded' => NULL,
//                            'free_shipping' => '0',
//                            'gift_message_id' => NULL,
//                            'gift_message_available' => '0',
//                            'weee_tax_applied' => NULL,
//                            'weee_tax_applied_amount' => NULL,
//                            'weee_tax_applied_row_amount' => NULL,
//                            'weee_tax_disposition' => NULL,
//                            'weee_tax_row_disposition' => NULL,
//                            'base_weee_tax_applied_amount' => NULL,
//                            'base_weee_tax_applied_row_amnt' => NULL,
//                            'base_weee_tax_disposition' => NULL,
//                            'base_weee_tax_row_disposition' => NULL,
//                            'base_aw_reward_points_amount' => '0.0000',
//                            'aw_reward_points_amount' => '0.0000',
//                            'aw_reward_points' => '0',
//                            'base_aw_reward_points_refunded' => NULL,
//                            'aw_reward_points_refunded' => NULL,
//                            'aw_reward_points_blnce_refunded' => NULL,
//                            'base_aw_reward_points_reimbursed' => NULL,
//                            'aw_reward_points_reimbursed' => NULL,
//                            'aw_reward_points_blnce_reimbursed' => NULL,
//                            'base_aw_reward_points_invoiced' => NULL,
//                            'aw_reward_points_invoiced' => NULL,
//                            'aw_reward_points_blnce_invoiced' => NULL,
//                            'osc_gift_wrap_amount' => NULL,
//                            'base_osc_gift_wrap_amount' => NULL,
//                        ),
//                ),
//        );
        $array = array('order_address' =>
                           array (
                               0 =>
                                   array (
                                       'entity_id' => '658229',
                                       'parent_id' => '331532',
                                       'customer_address_id' => NULL,
                                       'quote_address_id' => NULL,
                                       'region_id' => '76',
                                       'customer_id' => NULL,
                                       'fax' => NULL,
                                       'region' => 'Quebec',
                                       'postcode' => 'J0K1Y0',
                                       'lastname' => 'Bruneau',
                                       'street' => '316, avenue 3 Lac Vallée Ouest',
                                       'city' => 'Ste-Beatrix',
                                       'email' => 'veronique_bruneau@hotmail.com',
                                       'telephone' => '418-751-4669',
                                       'country_id' => 'CA',
                                       'firstname' => 'Véronique',
                                       'address_type' => 'shipping',
                                       'prefix' => NULL,
                                       'middlename' => NULL,
                                       'suffix' => NULL,
                                       'company' => NULL,
                                       'vat_id' => NULL,
                                       'vat_is_valid' => NULL,
                                       'vat_request_id' => NULL,
                                       'vat_request_date' => NULL,
                                       'vat_request_success' => NULL,
                                   ),
                               1 =>
                                   array (
                                       'entity_id' => '658230',
                                       'parent_id' => '331532',
                                       'customer_address_id' => NULL,
                                       'quote_address_id' => NULL,
                                       'region_id' => '76',
                                       'customer_id' => NULL,
                                       'fax' => NULL,
                                       'region' => 'Quebec',
                                       'postcode' => 'J0K1Y0',
                                       'lastname' => 'Bruneau',
                                       'street' => '316, avenue 3 Lac Vallée Ouest',
                                       'city' => 'Ste-Beatrix',
                                       'email' => 'veronique_bruneau@hotmail.com',
                                       'telephone' => '418-751-4669',
                                       'country_id' => 'CA',
                                       'firstname' => 'Véronique',
                                       'address_type' => 'billing',
                                       'prefix' => NULL,
                                       'middlename' => NULL,
                                       'suffix' => NULL,
                                       'company' => NULL,
                                       'vat_id' => NULL,
                                       'vat_is_valid' => NULL,
                                       'vat_request_id' => NULL,
                                       'vat_request_date' => NULL,
                                       'vat_request_success' => NULL,
                                   ),
                           ),);
        var_dump(str_replace('console/config', '', __DIR__ ));
//        return json_encode($array);
    }
}
